
-- SORT_QUERY_RESULTS

CREATE TABLE T1_n141(a STRING, b STRING, c STRING) ROW FORMAT DELIMITED FIELDS TERMINATED BY ' ' STORED AS TEXTFILE; 

LOAD DATA LOCAL INPATH '../../data/files/grouping_sets.txt' INTO TABLE T1_n141;

EXPLAIN
SELECT a, b, count(*) FROM T1_n141 GROUP BY a, b WITH CUBE ORDER BY a, b, GROUPING__ID LIMIT 10;

SELECT a, b, count(*) FROM T1_n141 GROUP BY a, b WITH CUBE ORDER BY a, b, GROUPING__ID LIMIT 10;

EXPLAIN
SELECT a, b, count(*) FROM T1_n141 GROUP BY a, b  GROUPING SETS (a, (a, b), b, ()) ORDER BY a, b, GROUPING__ID LIMIT 10;

SELECT a, b, count(*) FROM T1_n141 GROUP BY a, b  GROUPING SETS (a, (a, b), b, ()) ORDER BY a, b, GROUPING__ID LIMIT 10;

EXPLAIN
SELECT a, b, count(*) FROM T1_n141 GROUP BY a, b GROUPING SETS (a, (a, b)) ORDER BY a, b, GROUPING__ID LIMIT 10;

SELECT a, b, count(*) FROM T1_n141 GROUP BY a, b GROUPING SETS (a, (a, b)) ORDER BY a, b, GROUPING__ID LIMIT 10;

EXPLAIN
SELECT a FROM T1_n141 GROUP BY a, b, c GROUPING SETS (a, b, c) ORDER BY a, b, c, GROUPING__ID LIMIT 10;

SELECT a FROM T1_n141 GROUP BY a, b, c GROUPING SETS (a, b, c) ORDER BY a, b, c, GROUPING__ID LIMIT 10;

EXPLAIN
SELECT a FROM T1_n141 GROUP BY a GROUPING SETS ((a), (a)) ORDER BY a LIMIT 10;

SELECT a FROM T1_n141 GROUP BY a GROUPING SETS ((a), (a)) ORDER BY a LIMIT 10;

EXPLAIN
SELECT a + b, count(*) FROM T1_n141 GROUP BY a + b GROUPING SETS (a + b) ORDER BY a + b LIMIT 10;

SELECT a + b, count(*) FROM T1_n141 GROUP BY a + b GROUPING SETS (a + b) ORDER BY a + b LIMIT 10;
